package com.iplant.mes.service.po.exc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.ams.service.basicenum.exc.EXCUnusualTypes;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.basic.service.po.bpm.BPMTaskBase;

import java.io.Serializable;
import java.util.Calendar;


@DBBasePO(TableName = "exc_unusual_task", CheckName = {"Code"}, Name = false,
        CodeAuto = true, CodePrefix = "EXC-{yyMMdd}-", CodeNum = 4, Schemas = DBSchemas.MES)
public class EXCUnusualTask extends BPMTaskBase implements Serializable {
    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

    public EXCUnusualTask() {
        super();
    }

    /**
     * 异常类型
     */
    @DBCondition
    @DBField
    public int UnusualType = 0;

    public String UnusualTypeText = "";
    /**
     * 异常位置
     */
    @DBField
    public String PositionText = "";
    /**
     * 处理人ID
     */
    @DBField
    public int HandleID = 0;
    /**
     * 处理人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user1", Schemas = DBSchemas.Basic,
            MainTableField = "HandleID")
    public String HandleName = "";

    /**
     * 处理时间
     */
    @DBField
    public Calendar HandleTime = Calendar.getInstance();

    /**
     * 异常知识库ID
     */
    @DBCondition
    @DBField
    public int FaultBaseID = 0;

    /**
     * 异常描述
     */
    @DBJoin(name = "Description", tableName = "dms_fault_base", tableAsName = "dms_fault_base1", Schemas =
            DBSchemas.AMS,
            MainTableField = "FaultBaseID")
    public String UnusualRemark = "";

    /**
     * 异常工位 可以没有
     */
    @DBCondition
    @DBField
    public int StationID = 0;

    /**
     * 工位名称
     */
    @DBJoin(name = "Name", tableName = "fmc_station", tableAsName = "station1", Schemas = DBSchemas.Basic,

            MainTableField = "StationID")
    public String StationName = "";
    /**
     * 工位编码
     */
    @DBJoin(name = "Code", tableName = "fmc_station", tableAsName = "station1", Schemas = DBSchemas.Basic,

            MainTableField = "StationID")
    public String StationCode = "";

    @DBCondition
    @DBField
    public int DeviceID = 0;

    @DBJoin(name = "AssetInfoID", tableName = "dms_device_ledger", tableAsName = "d1", Schemas = DBSchemas.AMS,

            MainTableField = "DeviceID")
    public int AssetInfoID = 0;

    /**
     * 设备名称
     */
    @DBJoin(name = "Name", tableName = "ams_asset_list", tableAsName = "ams_asset_list1", Schemas = DBSchemas.AMS,
            JoinIndex = 2,

            ConditionalJoin = "d1.AssetInfoID=ams_asset_list1.ID")
    public String DeviceName = "";
    /**
     * 设备编码
     */
    @DBJoin(name = "Code", tableName = "ams_asset_list", tableAsName = "ams_asset_list1", Schemas = DBSchemas.AMS,
            JoinIndex = 2,

            ConditionalJoin = "d1.AssetInfoID=ams_asset_list1.ID")
    public String DeviceCode = "";

    @DBJoin(name = "ModelID", tableName = "dms_device_ledger", tableAsName = "d1", Schemas = DBSchemas.AMS,
            MainTableField = "DeviceID")
    public int ModelID = 0;

    @DBCondition
    @DBJoin(name = "DeviceTypeID", tableName = "dms_device_model", tableAsName = "dms_device_model1", Schemas =
            DBSchemas.AMS, JoinIndex = 2,
            ConditionalJoin = "d1.ModelID=dms_device_model1.Id")
    public int DeviceTypeID = 0;

    /**
     * 异常备注
     */
    @DBCondition
    @DBField
    public String ExcRemark = "";
    /**
     * 异常附件
     */
    @DBField
    public String ExcFileUrl = "";

    /**
     * 新增异常代码
     */
    @DBField
    public String NewExcCode = "";

    /**
     * 新增异常描述
     */
    @DBField
    public String NewExcDescription = "";

    /**
     * 新增异常办法
     */
    @DBField
    public String NewExcMethods = "";

    /**
     * 新增异常附件
     */
    @DBField
    public String NewExcUrls = "";


    @JsonProperty("UnusualType")
    public int getUnusualType() {
        return UnusualType;
    }

    public void setUnusualType(int unusualType) {
        UnusualType = unusualType;
    }


    @JsonProperty("UnusualTypeText")
    public String getUnusualTypeText() {
        UnusualTypeText = EXCUnusualTypes.getEnumType(UnusualType).getLabel();
        return UnusualTypeText;
    }

    public void setUnusualTypeText(String unusualTypeText) {
        UnusualTypeText = EXCUnusualTypes.getEnumType(UnusualType).getLabel();
        UnusualTypeText = unusualTypeText;
    }


    @JsonProperty("HandleTime")
    public Calendar getHandleTime() {
        return HandleTime;
    }

    public void setHandleTime(Calendar handleTime) {
        HandleTime = handleTime;
    }


    @JsonProperty("UnusualRemark")
    public String getUnusualRemark() {
        return UnusualRemark;
    }

    public void setUnusualRemark(String unusualRemark) {
        UnusualRemark = unusualRemark;
    }

    @JsonProperty("StationID")
    public int getStationID() {
        return StationID;
    }

    public void setStationID(int stationID) {
        StationID = stationID;
    }

    @JsonProperty("StationName")
    public String getStationName() {
        return StationName;
    }

    public void setStationName(String stationName) {
        StationName = stationName;
    }

    @JsonProperty("StationCode")
    public String getStationCode() {
        return StationCode;
    }

    public void setStationCode(String stationCode) {
        StationCode = stationCode;
    }

    @JsonProperty("DeviceID")
    public int getDeviceID() {
        return DeviceID;
    }

    public void setDeviceID(int deviceID) {
        DeviceID = deviceID;
    }

    @JsonProperty("DeviceName")
    public String getDeviceName() {
        return DeviceName;
    }

    public void setDeviceName(String deviceName) {
        DeviceName = deviceName;
    }

    @JsonProperty("DeviceCode")
    public String getDeviceCode() {
        return DeviceCode;
    }

    public void setDeviceCode(String deviceCode) {
        DeviceCode = deviceCode;
    }

    @JsonProperty("PositionText")
    public String getPositionText() {
        return PositionText;
    }

    public void setPositionText(String positionText) {
        PositionText = positionText;
    }

    @JsonProperty("HandleID")
    public int getHandleID() {
        return HandleID;
    }

    public void setHandleID(int handleID) {
        HandleID = handleID;
    }

    @JsonProperty("HandleName")
    public String getHandleName() {
        return HandleName;
    }

    public void setHandleName(String handleName) {
        HandleName = handleName;
    }

    @JsonProperty("ExcRemark")
    public String getExcRemark() {
        return ExcRemark;
    }

    public void setExcRemark(String excRemark) {
        ExcRemark = excRemark;
    }

    @JsonProperty("ExcFileUrl")
    public String getExcFileUrl() {
        return ExcFileUrl;
    }

    public void setExcFileUrl(String excFileUrl) {
        ExcFileUrl = excFileUrl;
    }

    @JsonProperty("AssetInfoID")
    public int getAssetInfoID() {
        return AssetInfoID;
    }

    public void setAssetInfoID(int assetInfoID) {
        AssetInfoID = assetInfoID;
    }

    @JsonProperty("NewExcCode")
    public String getNewExcCode() {
        return NewExcCode;
    }

    public void setNewExcCode(String newExcCode) {
        NewExcCode = newExcCode;
    }

    @JsonProperty("NewExcDescription")
    public String getNewExcDescription() {
        return NewExcDescription;
    }

    public void setNewExcDescription(String newExcDescription) {
        NewExcDescription = newExcDescription;
    }

    @JsonProperty("NewExcMethods")
    public String getNewExcMethods() {
        return NewExcMethods;
    }

    public void setNewExcMethods(String newExcMethods) {
        NewExcMethods = newExcMethods;
    }

    @JsonProperty("NewExcUrls")
    public String getNewExcUrls() {
        return NewExcUrls;
    }

    public void setNewExcUrls(String newExcUrls) {
        NewExcUrls = newExcUrls;
    }

    @JsonProperty("ModelID")
    public int getModelID() {
        return ModelID;
    }

    public void setModelID(int modelID) {
        ModelID = modelID;
    }

    @JsonProperty("DeviceTypeID")
    public int getDeviceTypeID() {
        return DeviceTypeID;
    }

    public void setDeviceTypeID(int deviceTypeID) {
        DeviceTypeID = deviceTypeID;
    }

    @JsonProperty("FaultBaseID")
    public int getFaultBaseID() {
        return FaultBaseID;
    }

    public void setFaultBaseID(int faultBaseID) {
        FaultBaseID = faultBaseID;
    }
}
